<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

        .box{
            display: flex;
        }
        .box-item{
            margin-right:100px;
            height:50px;
            line-height: 50px;
            text-align: center;
        }
        .box-itemActive{
            border-bottom: 2px solid blue;
            color:red;
        }
    </style>
</head>
<body>
    
    <div id="app">
        <!--  -->
       <div class="box">
        <div class="box-item" 
        :class="activeStyle==index?'box-itemActive':''" 
        v-for="(item,index) in list" 
        :key="index"
        @mouseover="change(index)">
          {{item}}
        </div>
       </div>  
       <!-- 对应的内容 -->
       <div v-if="activeStyle==0">扫地机</div>
       <div v-if="activeStyle==1">空净</div>
       <div v-if="activeStyle==2">风扇</div>
       <div v-if="activeStyle==3">清洁</div>
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>

   //选项卡

   let App = new Vue({
     el:'#app',
     data:{ //响应式=》数据改变视图对应更新
        num:100,
        list:[
            '扫地机',
            '空净',
            "风扇",
            "清洁"
        ],
        activeStyle:0
     },
     methods:{
        change(val){
            console.log(val);
            this.activeStyle = val
        }
     }
   })
</script>
</html>